package wzc.design_pattern.behaviour.iterator;

/**
 * @Author 那和不是个啥
 * @Date 2025/7/20
 * @Description
 */

public class IteratorPatternDemo {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf();
        bookShelf.addBook(new Book("Java高并发编程详解"));
        bookShelf.addBook(new Book("Java编程思想"));
        bookShelf.addBook(new Book("Spring实战"));

        Iterator<Book> iterator = bookShelf.iterator();
        while (iterator.hasNext()) {
            Book book = iterator.next();
            System.out.println("书籍" + book.getTitle());
        }
    }
}
